Compiling and Running Java

SpotCheck is capable of compiling and running Java code, but only with the assistance of helper applications. This document describes which 3rd-party compilers, applet viewers, and application runners are supported by SpotCheck, and how you can combine them to compile and run your SpotCheck projects.

Note that SpotCheck distinguishes between "applet viewers" and "application runners". The former are used to execute Java applets, naturally, while the latter can only run "standalone" Java applications with "public static void main ( String[] argv )" entry points. If your Java class extends java.lang.Applet, but also has a main entry point, SpotCheck will treat is as an applet rather than as an application, running it with your selected applet viewer.

Choosing Your Helpers

To select the helper applications you intend to use for your Java compiler, applet viewer, and application runner, simply execute the "Choose New Compiler" command from SpotCheck's Project menu. A dialog box will appear with various choices for each of the three helper categories. When you hit the "OK" button, SpotCheck will first check if the selected helpers are already running. If not, SpotCheck will ask you to find each of the helper applications you've indicated.

Note that you can "mix and match" compilers and runners/viewers: just because you compile with CodeWarrior doesn't mean you have to run the code using Metrowerks Java. Note also that you can choose "none" for any of the helpers, if you wish to compile or run by hand, or with an unsupported application.

Java Compilers

As of this writing, SpotCheck supports three compiler applications: CodeWarrior from Metrowerks, javac from Sun's JDK 1.0.2 for Macintosh, and another javac from Apple's Macintosh Runtime for Java SDK 2.0. The last two have very limited support for integration, so SpotCheck's interface with them is necessarily simple and straightforward: it just simulates a Finder drag-and-drop with one or more ".java" text files. Since neither javac is able to report compiler errors back to SpotCheck, SpotCheck must simply bring the compiler to the foreground, allowing the compiler to report failure or success directly to you.

The interface to CodeWarrior is much more sophisticated, since CodeWarrior is a full-fledged IDE with extensive support for integration. In particular, CodeWarrior is able to return error information to SpotCheck after a compile command. For this reason, SpotCheck does not bring CodeWarrior to the foreground during compilation, but rather waits for its response. Any compiler errors returned are then presented to you by SpotCheck. If you intend to use SpotCheck and CodeWarrior together, you'll almost certainly want to read more about the interface between SpotCheck and CodeWarrior, after you've finished this document.

In order to support a variety of Java applet viewers and application runners, SpotCheck directs its compiler helper to create its output in the form of loose ".class" files in a folder. If you need a different form of output, like ".zip" or ".jar" files, you will have to compile your Java code by hand, or possibly adjust the settings of your compiler or compiler project.

GenieWorks has plans to support Roaster and Symantec's Visual Cafe in upcoming releases of SpotCheck. If you're a user of one of those products, you should check our website for news about new releases.

Java Application Runners

SpotCheck currently supports two Java application runners, Metrowerks Java and Java Runner from Sun's JDK 1.0.2 for Macintosh. More here.

Java Applet Viewers

Any application that can display applets on HTML pages can be used as an applet viewer for SpotCheck. You can "spoof" SpotCheck by selecting one of the drag-and-drop applet viewers in the "Choose New Compiler" dialog, then finding a different application. If what you "find" is not what SpotCheck was looking for, your viewer will be used for the remainder of the SpotCheck session (or until you choose another one), but SpotCheck will record your viewer preference as "none".

Note that Metrowerks Java does not use the generic drag-and-drop interface for viewing applets, but rather has its own custom interface. As a result, you cannot "spoof" SpotCheck by trying to pass off another application as Metrowerks Java.

Virtual Machines

SpotCheck has no way of controlling which Java virtual machine executes the code when your selected applet viewer or application runner is launched. Some runner/viewer applications have the ability to select different virtual machines; you should configure your helper apps as needed, independently of SpotCheck.

Although SpotCheck does not yet support writing code that uses the newer Java 1.1 language and API features, you can use a 1.1 virtual machine to execute the Java 1.0 code you develop with SpotCheck.

The "SpotCheck Data" Folder

In order to support "mixing and matching" of different compiler and runner applications, and in order to isolate SpotCheck's output from your hand-written files, SpotCheck puts all of its output in a folder named "SpotCheck Data", which it creates next to your SpotCheck project file. (Always remember that any file you create or edit by hand in that folder may get overwritten by SpotCheck the next time it generates its output.) In addition, SpotCheck directs its compiler helper applications to place their ".class" file output in the "SpotCheck Data" folder as well. The following picture shows the organization of a typical SpotCheck project folder.

Since the output folder is always called "SpotCheck Data", regardless of the name of your project file, multiple projects in one folder will share the same output folder. This can only lead to confusion and mistakes, so we recommend that you place each of your SpotCheck project files in their own folder.

The placement of ".java", ".class", and ".html" files in the "SpotCheck Data" folder is critical to SpotCheck's integration with its compiler, applet viewer, and application runner helpers. If you wish to organize the output files differently, you'll be forced to compile or run your project by hand.